package com.fcb.pois.config;

import com.aliyun.dyplsapi20170525.models.QuerySubsIdRequest;
import com.aliyun.dyplsapi20170525.models.QuerySubsIdResponse;
import com.aliyun.dyplsapi20170525.models.QuerySubsIdResponseBody;
import com.aliyun.teaopenapi.models.Config;

public class AliyunSample {

    /**
     * 使用AK&SK初始化账号Client
     * @param accessKeyId
     * @param accessKeySecret
     * @return Client
     * @throws Exception
     */
    public static com.aliyun.dyplsapi20170525.Client createClient(String accessKeyId, String accessKeySecret) throws Exception {
        Config config = new Config()
                // 您的AccessKey ID
                .setAccessKeyId(accessKeyId)
                // 您的AccessKey Secret
                .setAccessKeySecret(accessKeySecret);
        // 访问的域名
        config.endpoint = "dyplsapi.aliyuncs.com";
        return new com.aliyun.dyplsapi20170525.Client(config);
    }
    public static String getSubId(String phoneNoX) throws Exception {
        com.aliyun.dyplsapi20170525.Client client = AliyunSample.createClient("LTAI5tFPzLnPiasAytPE1kcu", "uOF6Wf0nigA8YVOVMHKEp8u8LTs2MY");
        QuerySubsIdRequest querySubsIdRequest = new QuerySubsIdRequest()
                .setPoolKey("FC100000133260732")
                .setPhoneNoX(phoneNoX);
        // 复制代码运行请自行打印 API 的返回值
        QuerySubsIdResponse xx = client.querySubsId(querySubsIdRequest);
        QuerySubsIdResponseBody body = xx.getBody();
        String x = body.getSubsId();
        return x;
    }




}
